
#ifndef FONTDIALOG_H
#define FONTDIALOG_H

#include <BFont>
#include <BLabel>
#include <BComboBox>
#include <BLineEdit>
#include <BDialog>
#include <BListWidget>
#include <BSpinBox>
#include <BCheckBox>

using namespace BWE;

class FontDialog : public BDialog
{
	BOBJECT(FontDialog)
public:
	FontDialog(BWidget* parent = 0);
	~FontDialog();

	void setFont(BFont* font);
	BFont* font();

protected:
	static Encoding StringToEncoding(const BString& text);
	static BString StringFromEncoding(Encoding encoding);

protected:
	void slotSizeEditFinished(BObject* object, const BValue& value);
	void slotFamilyListWidgetFramed(BObject* object, const BValue& value);
	void slotFamilySelectionChanged(BObject* object, const BValue& value);
	void slotEncodingSelectionChanged(BObject* object, const BValue& value);
	void slotSizeSelectionChanged(BObject* object, const BValue& value);

	void slotBoldCheckBoxToggled(BObject* object, const BValue& value);
	void slotItalicCheckBoxToggled(BObject* object, const BValue& value);
	void slotMonospaceCheckBoxToggled(BObject* object, const BValue& value);
	void slotTabSizeEditFinished(BObject* object, const BValue& value);

	void slotConfirmButtonClicked(BObject* object, const BValue& value);
	void slotCancelButtonClicked(BObject* object, const BValue& value);

protected:
	virtual void showEvent(const BEvent& event);
	virtual void hideEvent(const BEvent& event);

private:
	BLineEdit*			_familyEdit;
	BListWidget*		_familyListWidget;
	BLineEdit*			_encodingEdit;
	BListWidget*		_encodingListWidget;
	BSpinBox*			_sizeSpinBox;
	BListWidget*		_sizeListWidget;
	BCheckBox*			_boldCheckBox;
	BCheckBox*			_italicCheckBox;
	BCheckBox*			_monospaceCheckBox;
	BSpinBox*			_tabSizeSpinBox;
	BLabel*				_sampleLabel;

	BButton*			_confirmButton;
	BButton*			_cancelButton;

	BFontHolder			_font;
};

#endif
